<template></template>

<script lang="ts" setup>
import { ElMessage, ElMessageBox } from "element-plus";
import { defineEmits } from "vue";
import { DeleteUser } from "@/api/Users";
const emit = defineEmits(["deleteUser"]);
const open = (index: number, row: any) => {
  console.log(index, row);

  ElMessageBox.confirm("此操作将永久删除该用户, 是否继续?", "提示", {
    confirmButtonText: "确定删除",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(async () => {
      ElMessage({
        type: "success",
        message: "确认删除成功",
      });
      let res = await DeleteUser(row.id);
      emit("deleteUser", index);
      console.log(res, "shanchu信息");
    })
    .catch(() => {
      ElMessage({
        type: "info",
        message: "取消删除",
      });
    });
};
defineExpose({
  open,
});
</script>
